export const first = function(params){
  const baseUrl = 'https://api-hmugo-web.itheima.net/api/public/v1'
  wx.showToast({
    title: '请稍等',
    icon: 'loading'
  })
  return new Promise((res,rej)=>{
    wx.request({
      url: baseUrl + params.url,
      data: params.data,
      method: params.method || 'get',
      success(result){
        res(result.data.message)
      },
      complete:(x)=>{
        wx.hideToast({
          complete: (res) => {},
        })
      },
      error(result){
        rej(result)
      }
    })
  })
}

export const two = function(params){
  const baseUrl = 'https://api.zbztb.cn/api/public/v1'
  wx.showToast({
    title: '请稍等',
    icon: 'loading'
  })
  return new Promise((res,rej)=>{
    wx.request({
      url: baseUrl + params.url,
      data: params.data,
      method: params.method || 'get',
      success(result){
        res(result.data.message)
      },
      complete:(x)=>{
        wx.hideToast({
          complete: (res) => {},
        })
      },
      error(result){
        rej(result)
      }
    })
  })
}